<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.db.conn"%>
<%@ page import="java.sql.*"%>
<%@ page import="com.db.Pagination"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
<jsp:include flush="true" page="${basePath}/admin/head.jsp"></jsp:include>
 </head>


 
 <body>

 <div class="card">
        <ul class="nav nav-tabs page-tabs">
            <li class="active"><a>待处理退款申请</a></li>
        </ul>
        <div class="tab-content" style="min-height: 450px;">

<table style="width: 100%;">
	<tr>
		<td align="center">
			                <form action="<%=path %>/admin/reimburse/reimburse_Manage.jsp" method="post">

<strong> 订单编号:</strong><input name="txt_no" type="text" id="txt_no" style="width:150px;"  />

                <input name="search" type="submit" border="0" class="btn btn-primary"	value='查询' />
                </form>


		</td>
	</tr>
	<tr>
		<td align="center">
			 <%
//定义四个分页会用到的变量
int pageSize=15;
int pageNow=1;//默认显示第一页
int rowCount=0;//该值从数据库中查询
int pageCount=0;//该值是通过pageSize和rowCount
//接受用户希望显示的页数（pageNow）
String s_pageNow=request.getParameter("pageNum");
if(s_pageNow!=null){
//接收到了pageNow
pageNow=Integer.parseInt(s_pageNow);
}

String where="  rflag='等待处理' ";
if(request.getParameter("txt_no")!=null)
{
where+=" and no like '%"+request.getParameter("txt_no")+"%' ";
}


conn cn=new conn();


ResultSet rs=cn.query("select count(*) from reimburse a where "+where);
if(rs.next()){
rowCount=rs.getInt(1);
}

//计算pageCount
if(rowCount%pageSize==0){
pageCount=rowCount/pageSize;
}else{
pageCount=rowCount/pageSize+1;
}
//查询出需要显示的记录
 
rs=cn.query("select  * from reimburse a where "+where+" order by id desc limit "+pageSize*(pageNow-1)+", "+pageSize);

%>

	<table cellspacing="0" border="0" style="width:100%;border-collapse:collapse;"  >
		<tr>
    <th >订单编号</th>
    <th >退款原因</th>
    <th >提交时间</th>
    <th >处理状态</th>

			<th scope="col">操作</th>		</tr>
		<%
while(rs.next()){
%>
		<tr align="center" >
  			<td>
				<a href="<%=path%>/admin/orders/orders_Detail.jsp?id=<%=rs.getString("no") %>"><%=rs.getString("no") %></a>
			</td>
  			<td><%=rs.getString("ques")!=null && rs.getString("ques").length()>20?rs.getString("ques").substring(0,20)+"……": rs.getString("ques")==null ?"":rs.getString("ques") %></td>
  			<td><%=rs.getString("rtime") %></td>
  			<td><%=rs.getString("rflag") %></td>

			<td >
           <a href="<%=path %>/admin/reimburse/reimburse_Detail.jsp?id=<%=rs.getString("id") %>">详细</a>&nbsp;
           <a href="<%=path %>/admin/reimburse/reimburse_Edit.jsp?id=<%=rs.getString("id") %>">处理</a>&nbsp;
           <a href="<%=path %>/reimburse_Delete?id=<%=rs.getString("id") %>">删除</a>
		</tr>
<%} %>

</table>
<table width=100%>
	<tbody>
		<tr>
			<td align="center">
				<%=Pagination.getPagination(pageNow,pageCount,rowCount,request.getRequestURI())
				%>
			</td>
		</tr>
</table>


        </div>
    </div>


</body>
</html>



